
const web17Students = [
    '毕贤',
    '陈冬冬',
    '陈海涛',
    '郭琦',
    '黄艺德',
    '孙康迪',
    '王为',
    '吴江鹏',
    '叶涛',
    '袁兆军',
    '占旭',
    '张成伟',
    '周锦雄',
    '胡来亮'
  ]
  const http = require('http')
  const fs = require('fs')
  let server = http.createServer(function(request,response){
    let path = '../我的作业/6-15作业'
    response.setHeader('Access-Control-Allow-Origin','*')
    fs.access(path,function(w){
      if(w){
        console.log('路径是否存在：false')
      }else{
        console.log('路径是否存在：ture')
      }
    })
    fs.readdir(path,function(_err,res){
      let arr3 = []
      res.forEach(function(w){
        let reg = new RegExp('[\u4e00-\u9fa5]','g')
        let str = w
        let arr1 = str.match(reg)
        let arr2 = arr1.join('')
        arr3.push(arr2)
      })
      function isExisArr(arr,deletearr,submitarr){
        arr.forEach(function(item){
          if (deletearr.indexOf(item) === -1){
            submitarr.push(item)
          }
        })
        return submitarr
      }
      let dv = []
      let noarr = isExisArr(web17Students,arr3,dv)
      console.log('班级:web17')
      console.log('班级人数：' + web17Students.length)
      console.log('没交作业的人数：' + noarr.length)
      console.log('没交作业的人有：' + noarr)
      response.end()
    })
    response.end()
  })
  server.listen(8001,'127.0.0.1',function(){
    console.log('server is running on http://127.0.0.1:8001')
  })